


class Animal {
    public String name;
    public int age;

    public void eat() {
        System.out.println(name+"正在吃饭");
    }
}

class Dog extends Animal {
    public String color;
    public void wangwang() {
        System.out.println(name+"正在汪汪叫！");
    }

    @Override
    public void eat() {
        System.out.println(name+"正在吃狗粮。");
    }
}

class Cat extends Animal {
    public String color;
    public void miaomiao() {
        System.out.println(name+"正在喵喵叫！");
    }

    @Override
    public void eat() {
        System.out.println(name+"正在吃猫粮。");
    }
}

class Bird extends Animal {
    public String wing;
    public void fly() {
        System.out.println(name+"正在big fly");
    }

    @Override
    public void eat() {
        System.out.println(name+"正在吃虫子。");
    }
}

public class Test {

    public static void func(Animal animal) {

    }

    public static Animal func2() {
        return new Dog();
    }

    public static void main(String[] args) {
        Animal animal = new Dog();
        animal.name = "来福";
        animal.eat();
        System.out.println("---------");
        Animal animal2 = new Bird();
        animal2.name = "常威";
        animal2.eat();
    }

    public static void main2(String[] args) {
        Dog dog = new Dog();
        func(dog);
    }

    public static void main1(String[] args) {
        Dog dog = new Dog();
        dog.name = "旺财";
        dog.eat();
        System.out.println("---------");
        Animal animal = new Dog();
        animal.name = "来福";
        animal.eat();
        System.out.println("---------");
        Animal animal2 = new Bird();
        animal2.name = "常威";
        animal2.eat();
    }

}
